package cn.yougou.serviceImpl;

import cn.yougou.common.RandomUtil;
import cn.yougou.mapper.YgOrderMapper;
import cn.yougou.pojo.YgOrder;
import cn.yougou.service.admin.YgAdminOrderService;
import cn.yougou.vo.YgOrderVo;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * @auth 韩帅锋
 * @date 2020/12/27 8:54
 */
@Service
public class YgAdminOrderServicelmpl implements YgAdminOrderService {


    @Autowired
    private YgOrderMapper ygOrderMapper;

    /**
     * 查询订单的信息
     * @return
     */


    @Override
    public List<YgOrderVo> orderVo(YgOrderVo ygOrderVo) {
        List<String> o = ygOrderVo.getTimeArray();
        for (int i= 0; o.size() > 0; i++){
            ygOrderVo.setStart(ygOrderVo.getTimeArray().get(i));
            ygOrderVo.setEnd(ygOrderVo.getTimeArray().get(i+1));
            break;
        }
        List<YgOrderVo> listVo = ygOrderMapper.selCondition(ygOrderVo);
        return listVo;
    }

    @Override
    public int deleteById(YgOrderVo ygOrderVo) {
        int id = ygOrderVo.getId();
        return ygOrderMapper.deleteById(id);
    }


}
